﻿@using DualControl.CommonServices
@using DualControl.Web.Models.Common.Modals
@model DualControl.Web.Models.Users.EditUserModalViewModel
@{
    Layout = null;
}
@Html.Partial("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditUser")))

@inject ICommonService CommonService

<div class="modal-body">
    <form name="UserPostAndOrgForm" role="form" novalidate class="form-validation">
        <input type="hidden" name="Id" value="@Model.User.Id" />
        <ul class="nav nav-tabs tab-nav-right" role="tablist">
<li role="presentation" class="active"><a href="#edit-user-details" data-toggle="tab">@L("UserDetails")</a></li>
 <li role="presentation"><a href="#edit-user-organizationunit" data-toggle="tab">部门</a></li>
<li role="presentation"><a href="#edit-user-posts" data-toggle="tab">岗位</a></li>

        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane animated fadeIn active" id="edit-user-details">
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="username" type="text" name="UserName" readonly value="@Model.User.UserName" required maxlength="32" minlength="2" class="validate form-control">
                                <label for="username" class="form-label">@L("UserName")</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="name" type="text" name="Name" value="@Model.User.Name" readonly required maxlength="32" class="validate form-control">
                                <label for="name" class="form-label">@L("Name")</label>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" name="PhoneNumber" class="form-control" readonly value="@Model.User.PhoneNumber" required maxlength="11">
                                <label class="form-label">@L("PhoneNumber")</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="email" type="email" name="EmailAddress" readonly value="@Model.User.EmailAddress" maxlength="256" class="validate form-control">
                                <label for="email" class="form-label">@L("EmailAddress")</label>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="">
                                <input id="IsActive" type="checkbox" name="IsActive" value="true" @(Model.User.IsActive ? "checked" : "") class="form-control" />
                                <label for="IsActive" class="form-label">@L("IsActive")</label>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        

            <div role="tabpanel" class="tab-pane animated fadeIn" id="edit-user-organizationunit">
                <div class="row">
                    <div class="col-sm-12 ">
                        @Html.DropDownListFor(m=>m.OrganizationUnitId, CommonService.GetOrganizationUnits().Select(c =>
          new SelectListItem() { Text = c.Value.ToString(), Value = c.Key.ToString() }), "==请选择责任部门==", new { @class = "dropdownlist" })


                    </div>
                </div>
            </div>
            <div role="tabpanel" class="tab-pane animated fadeIn" id="edit-user-posts">
                <div class="row">
                    <div class="col-sm-12 ">

                        @Html.DropDownListFor(m=>m.PostId,CommonService.GetPosts().Select(c =>
                                     new SelectListItem() { Text = c.Value.ToString(), Value = c.Key.ToString() }), "==请选择岗位==", new { @class = "dropdownlist" })


                    </div>
                </div>
            </div>



        </div>
    </form>
</div>

@Html.Partial("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")

<script src="~/view-resources/Views/Users/_EditUserPostAndOrg.js" asp-append-version="true"></script>
